package com.lxyk.yygh.oss.controller;

import com.alibaba.fastjson.JSONObject;
import com.lxyk.yygh.common.result.Result;
import com.lxyk.yygh.oss.service.FileService;
import com.lxyk.yygh.oss.utils.ConstantOssPropertiesUtils;
import com.lxyk.yygh.oss.vo.UserAuthVO;
import okhttp3.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/api/oss/file")
public class FileApiController {
    @Autowired
    private FileService fileService;

    //上传文件到阿里云oss
    @PostMapping("fileUpload")
    public Result fileUpload(MultipartFile file){
        //获取上传文件
        UserAuthVO userAuth = fileService.upload(file);
        return Result.ok(userAuth);
    }

    //病历识别
    @PostMapping("/uploadrecord")
    public Result uploadrecord(MultipartFile file){
        return fileService.uploadrecord(file);
    }
}
